package com.ruoyi.system.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SalonOrderMapper;
import com.ruoyi.system.domain.SalonOrder;
import com.ruoyi.system.service.ISalonOrderService;

/**
 * 创建订单Service业务层处理
 *
 * @author 23
 * @date 2022-04-03
 */
@Service
public class SalonOrderServiceImpl implements ISalonOrderService
{
    @Autowired
    private SalonOrderMapper salonOrderMapper;

    /**
     * 查询创建订单
     *
     * @param orderId 创建订单主键
     * @return 创建订单
     */
    @Override
    public SalonOrder selectSalonOrderByOrderId(Integer orderId)
    {
        return salonOrderMapper.selectSalonOrderByOrderId(orderId);
    }

    /**
     * 查询创建订单列表
     *
     * @param salonOrder 创建订单
     * @return 创建订单
     */
    @Override
    public List<SalonOrder> selectSalonOrderList(SalonOrder salonOrder)
    {
        return salonOrderMapper.selectSalonOrderList(salonOrder);
    }

    /**
     * 新增创建订单
     *
     * @param salonOrder 创建订单
     * @return 结果
     */
    @Override
    public int insertSalonOrder(SalonOrder salonOrder)
    {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String newDate = sdf.format(new Date());
        salonOrder.setOrderNo(newDate);
        return salonOrderMapper.insertSalonOrder(salonOrder);
    }

    /**
     * 修改创建订单
     *
     * @param salonOrder 创建订单
     * @return 结果
     */
    @Override
    public int updateSalonOrder(SalonOrder salonOrder)
    {
        return salonOrderMapper.updateSalonOrder(salonOrder);
    }

    /**
     * 批量删除创建订单
     *
     * @param orderIds 需要删除的创建订单主键
     * @return 结果
     */
    @Override
    public int deleteSalonOrderByOrderIds(Integer[] orderIds)
    {
        return salonOrderMapper.deleteSalonOrderByOrderIds(orderIds);
    }

    /**
     * 删除创建订单信息
     *
     * @param orderId 创建订单主键
     * @return 结果
     */
    @Override
    public int deleteSalonOrderByOrderId(Integer orderId)
    {
        return salonOrderMapper.deleteSalonOrderByOrderId(orderId);
    }


}
